#include <stdlib.h>
#include <stdio.h>
#include <gtk/gtk.h>

#include "main.h"

#include "win_new.h"

void win_new() {
#if 0
    // TODO : faire une table

    GtkWidget *dialog;
    GtkWidget *content_vbox;
    GtkWidget *button_first, *button_second;
    gint result;

    dialog = gtk_dialog_new_with_buttons(
        "Choose source and destination",
        GTK_WINDOW(globals.win_main),
        GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
        GTK_STOCK_CANCEL,
        GTK_RESPONSE_CANCEL,
        GTK_STOCK_OK,
        GTK_RESPONSE_ACCEPT,
        NULL
    );
    content_vbox=gtk_dialog_get_content_area(GTK_DIALOG(dialog));

    button_first=gtk_file_chooser_button_new ("Select a first file", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
    gtk_widget_show(button_first);
    gtk_box_pack_start(GTK_BOX(content_vbox), button_first, FALSE, TRUE, 0);

    button_second=gtk_file_chooser_button_new ("Select a second file", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
    gtk_widget_show(button_second);
    gtk_box_pack_start(GTK_BOX(content_vbox), button_second, FALSE, TRUE, 0);

    result=gtk_dialog_run (GTK_DIALOG (dialog));
    if(result==GTK_RESPONSE_ACCEPT) {
        sync_new(
            gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(button_first)),
            gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(button_second))
        );
    }
    gtk_widget_destroy (dialog);
#endif
    if(globals.synq_real) synq_free(globals.synq_real);

    {
        unsigned int i;
        for(i=0; i<arg_c; i++)
            printf("arg_v[%d]=\"%s\"\n", i, arg_v[i]);
    }

    globals.synq_real=synq_get_status(&arg_v[1], arg_c-1);    // give the extra arguments (must be the folders)
    if(!globals.synq_real) {
        printf("can't create synq\n");
        exit(1);
    }

    tree_update(globals.tree, globals.synq_real);
}

